﻿<Window x:Class="TP_WPFScreen.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="Demo Aplicación" Height="599" Width="800" Loaded="Window_Loaded_1" WindowStartupLocation="CenterScreen" Background="Black">    
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition />
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>
        
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="*"  />
            <ColumnDefinition Width="4*" />
        </Grid.ColumnDefinitions>

        <Menu Grid.Row="0" Grid.ColumnSpan="2" Height="25">
            <MenuItem Header="Archivo" Name="menuArchivo">
                <!--
                <MenuItem Header="Nuevo" Name="menuNuevo"></MenuItem>
                <MenuItem Header="Abrir" Name="menuAbrir"></MenuItem>
                <MenuItem Header="Guardar" Name="menuGuardar"></MenuItem>
                -->
                <MenuItem Header="Salir" Name="menuSalir" Click="menuSalir_Click"></MenuItem>
            </MenuItem>
            <MenuItem Header="Acerca de" Name="menuAbout" Click="menuAbout_Click"></MenuItem>
        </Menu>
        
        <TreeView Grid.Row="1" Grid.Column="0" Name="vCategorias" ItemsSource="{Binding}" SelectedItemChanged="vCategorias_SelectedItemChanged_1">
            <TreeView.ItemTemplate>
                <HierarchicalDataTemplate>
                    <Border>
                        <TextBlock Text="{Binding Path=Nombre}" />
                    </Border>
                </HierarchicalDataTemplate>
            </TreeView.ItemTemplate>
        </TreeView>
        
        <Button Grid.Column="0" Grid.Row="2" Name="btnInfo" Content="Ver Información" VerticalAlignment="Bottom" Click="btnInfo_Click"/>
        <!--
            <TreeView Name="tv" ItemsSource="{Binding}">
            <TreeView.Resources>
                <DataTemplate x:Key="childrenDataTemplate">
                    <TextBlock Text="{Binding}" />
                </DataTemplate>
            </TreeView.Resources>
            <TreeView.ItemTemplate>
                <HierarchicalDataTemplate ItemsSource="{Binding Path=ItemList}" ItemTemplate="{StaticResource ResourceKey=childrenDataTemplate}">
                    <Border BorderBrush="BurlyWood" BorderThickness="2">
                        <TextBlock Text="{Binding Path=Name}" />
                    </Border>
                </HierarchicalDataTemplate>
            </TreeView.ItemTemplate>
            </TreeView>
            -->

        <Viewbox Grid.Row="1" Grid.Column="1" Grid.RowSpan="2">
            <Canvas>
                <Viewport3D Name="layout" ClipToBounds="True" Canvas.Top="10" Canvas.Left="0">
                    <Viewport3D.Camera>
                        <PerspectiveCamera x:Name="camera" LookDirection="-50,0,0" Position="100,0,0" FieldOfView="90" UpDirection="0,1,0"/>
                    </Viewport3D.Camera>
                    <ModelVisual3D x:Name="model">
                        <ModelVisual3D.Content>
                            <Model3DGroup x:Name="group">
                                <DirectionalLight Color="#FFFFFF" Direction="0 -30 0" />
                                <DirectionalLight Color="#FFFFFF" Direction="0 +30 0" />
                            </Model3DGroup>
                        </ModelVisual3D.Content>
                        <ModelVisual3D.Transform>
                            <Transform3DGroup>
                                <RotateTransform3D>
                                    <RotateTransform3D.Rotation>
                                        <AxisAngleRotation3D Axis="1 0 0" Angle="{Binding XAngle}" />
                                    </RotateTransform3D.Rotation>
                                </RotateTransform3D>
                                <RotateTransform3D>
                                    <RotateTransform3D.Rotation>
                                        <AxisAngleRotation3D Axis="0 1 0" Angle="{Binding YAngle}" />
                                    </RotateTransform3D.Rotation>
                                </RotateTransform3D>
                                <!--<RotateTransform3D>
                                    <RotateTransform3D.Rotation>
                                        <AxisAngleRotation3D Axis="0 1 0" Angle="0" x:Name="rotationY" />
                                    </RotateTransform3D.Rotation>
                                </RotateTransform3D>-->
                            </Transform3DGroup>
                        </ModelVisual3D.Transform>
                    </ModelVisual3D>
                    <ModelVisual3D>
                        <ModelVisual3D.Content>
                            <Model3DGroup x:Name="moonGroup">
                                <DirectionalLight Color="#FFFFFF" Direction="0 -30 0" />
                                <DirectionalLight Color="#FFFFFF" Direction="0 +30 0" />
                            </Model3DGroup>
                        </ModelVisual3D.Content>
                        <ModelVisual3D.Transform>
                            <Transform3DGroup>
                                <RotateTransform3D>
                                    <RotateTransform3D.Rotation>
                                        <AxisAngleRotation3D Axis="1 0 0" Angle="{Binding XAngle}" />
                                    </RotateTransform3D.Rotation>
                                </RotateTransform3D>
                                <RotateTransform3D>
                                    <RotateTransform3D.Rotation>
                                        <AxisAngleRotation3D Axis="0 1 0" Angle="{Binding YAngle}" />
                                    </RotateTransform3D.Rotation>
                                </RotateTransform3D>
                                <RotateTransform3D>
                                    <RotateTransform3D.Rotation>
                                        <AxisAngleRotation3D Axis="{Binding VectorY}" Angle="0" x:Name="rotationY" />
                                    </RotateTransform3D.Rotation>
                                </RotateTransform3D>
                            </Transform3DGroup>
                        </ModelVisual3D.Transform>
                    </ModelVisual3D>
                    <Viewport3D.Triggers>
                        <EventTrigger RoutedEvent="Viewport3D.Loaded">
                            <BeginStoryboard>
                                <Storyboard Name="storyboardY">
                                    <DoubleAnimation
                                                    Storyboard.TargetName="rotationY"
                                                    Storyboard.TargetProperty="Angle"
                                                    From="0" To="360" Duration="0:0:0.5" RepeatBehavior="Forever" />
                                </Storyboard>
                            </BeginStoryboard>
                        </EventTrigger>
                    </Viewport3D.Triggers>
                </Viewport3D>
            </Canvas>
        </Viewbox>
        
    </Grid>
</Window>
